/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author hancing.com
 */
import { defHttp } from '/@/utils/http/axios';
import type { ResponseType } from 'axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface DpChatai extends BasicModel<DpChatai> {
  title?: string; // 标题
  count?: number; // 包含数量（条）
  jiage?: number; // 价格
  orderno?: number; // 排序号
}

export const dpChataiList = (params?: DpChatai | any) =>
  defHttp.get<DpChatai>({ url: adminPath + '/dp/chatai/dpChatai/list', params });

export const dpChataiListData = (params?: DpChatai | any) =>
  defHttp.post<Page<DpChatai>>({ url: adminPath + '/dp/chatai/dpChatai/listData', params });

export const dpChataiForm = (params?: DpChatai | any) =>
  defHttp.get<DpChatai>({ url: adminPath + '/dp/chatai/dpChatai/form', params });

export const dpChataiSave = (params?: any, data?: DpChatai | any) =>
  defHttp.postJson<DpChatai>({ url: adminPath + '/dp/chatai/dpChatai/save', params, data });

export const dpChataiDelete = (params?: DpChatai | any) =>
  defHttp.get<DpChatai>({ url: adminPath + '/dp/chatai/dpChatai/delete', params });


export const difyStream:any = (content:string) => {
  var headers = {
    'Authorization': 'Bearer app-kCyYtsgoUauFa1oIT21ZmCF7',
    'Content-Type': 'application/json'
  }
  var data = {
      "inputs": {"input_start": content},
      "response_mode": "streaming",
      "user": "abc-123"
  }
  let responseType:ResponseType  = 'stream'
  var params = {}
  return defHttp.postJson<DpChatai>({ url:  '/dify', headers, params, data, responseType });
}
  
